package com.bluesmart.mia;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

public class ConsumeDetailActivity extends BaseActivity implements OnClickListener{
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		JSONObject json = JSON.parseObject(getIntent().getStringExtra("info"));
		String isWater = json.getString("isWater");
		if(isWater.equals("true"))
			setContentView(R.layout.activity_detail_water);
		else
		{
			setContentView(R.layout.activity_detail_milk);
	        ((TextView)findViewById(R.id.text2)).setText(json.getString("prepared_temp") + "°c");
	        ((TextView)findViewById(R.id.text3)).setText(json.getString("goal_temp") + "°c");
		}
		
		((TextView)findViewById(R.id.text0)).setText(json.getString("consumed_ml") + "ml");
        ((TextView)findViewById(R.id.text1)).setText(json.getString("feedlongtime") + " | " + json.getString("time"));
        findViewById(R.id.left).setOnClickListener(this);
	}
	
	@Override
	public void onClick(View arg0) {
		switch(arg0.getId())
		{
		case R.id.left:
			finish();
			break;
		}
	}
}
